🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / firmware / src / commonMain / kotlin / org / meshtastic / feature / firmware / ota / dfu / DfuUploadTransport.kt
Displaying Raw • Download
feature/firmware/src/commonMain/kotlin/org/meshtastic/feature/firmware/ota/dfu/DfuUploadTransport.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 2.26 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.firmware.ota.dfu
T8b949e/**
* Common upload-time surface implemented by both [SecureDfuTransport] (Nordic Secure DFU, service `FE59`) and
* [LegacyDfuTransport] (Nordic Legacy DFU / Adafruit BLEDfu, service `1530`).
*
* The choice of which implementation to use is made by the handler after the device reboots into bootloader mode, based
* on which DFU service is exposed.
*/
Tff7b72interface T56d364DfuUploadTransport Tb4b4b4{
T8b949e/**
* True once connected if the bootloader can only transfer in small (≤20-byte) blocks — i.e. it did not negotiate a
* larger ATT MTU. Used to surface a "slow bootloader" advisory to the user. Valid after [connectToDfuMode].
*/
Tff7b72val Te6edf3isLowSpeedTransferTb4b4b4: Tffa657Boolean
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Tff7b72false
T8b949e/** Establish the GATT session with the device in DFU mode. */
Tff7b72suspend Tff7b72fun Td2a8ffconnectToDfuModeTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ResultTff7b72<Tffa657UnitTff7b72>
T8b949e/** Upload the init packet (`.dat`) and have the device validate it. */
Tff7b72suspend Tff7b72fun Td2a8fftransferInitPacketTb4b4b4(Te6edf3initPacketTb4b4b4: Te6edf3ByteArrayTb4b4b4)Tb4b4b4: Te6edf3ResultTff7b72<Tffa657UnitTff7b72>
T8b949e/**
* Upload the firmware binary (`.bin`). [onProgress] is invoked with a value in `[0.0, 1.0]` after each protocol
* checkpoint (PRN window or end-of-image).
*/
Tff7b72suspend Tff7b72fun Td2a8fftransferFirmwareTb4b4b4(Te6edf3firmwareTb4b4b4: Te6edf3ByteArrayTb4b4b4, Te6edf3onProgressTb4b4b4: Te6edf3suspend Tb4b4b4(Tffa657FloatTb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tb4b4b4: Te6edf3ResultTff7b72<Tffa657UnitTff7b72>
T8b949e/**
* Best-effort abort. Operational transport exceptions are swallowed; structured-concurrency cancellation and Error
* subtypes propagate.
*/
Tff7b72suspend Tff7b72fun Td2a8ffabortTb4b4b4(Tb4b4b4)
T8b949e/** Disconnect and release resources. */
Tff7b72suspend Tff7b72fun Td2a8ffcloseTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s